<template>
  <template v-for="(item) in menuData" :key="item.menuId">
    <el-sub-menu :index="item.menuId+''" v-if="item.children?.length">
      <template #title>
        <el-icon v-if="item.icon">
          <component :is="item.icon"></component>
        </el-icon>
        <span>{{ item.name }}</span>
      </template>
      <left-menu :menuList="item.children"></left-menu>
    </el-sub-menu>
    <el-menu-item :index="item.menuId+''" v-else :key="item.menuId">
      <el-icon v-if="item.icon">
        <component :is="item.icon"></component>
      </el-icon>
      <span>{{ item.name }}</span>
    </el-menu-item>
  </template>
</template>

<script setup lang="ts">
import {defineAsyncComponent, defineProps, reactive, watch} from 'vue'


let menuList = defineProps(['menuList'])
let menuData = reactive(menuList).menuList
// console.log(787, menuData)
watch(() => menuData, (newVal, oldVal) => {
  menuData = newVal
}, {
  deep: true,
  immediate: true
})
const leftMenu = defineAsyncComponent(() => import('../../components/left-menu/index.vue'))
</script>

<style lang="less" scoped>
.m_c {

}
</style>
